import Vue from "vue"
import VueRouter from "vue-router"

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: "/home",
    component: () => import("@/views/home/Home.vue"),
  },
  {
    path: "/category",
    component: () => import("@/views/category/Category.vue"),
  },
  {
    path: "/shop-cart",
    component: () => import("@/views/shop-cart/ShopCart.vue"),
  },
  {
    path: "/profile",
    component: () => import("@/views/profile/Profile.vue"),
  },
  {
    // path: "/detail/:id",  //动态路由
    path: "/detail",
    component: () => import("@/views/detail/Detail.vue")
  }
]

const router = new VueRouter({
  mode: "history",
  routes,
})

export default router
